package com.sk.bilibili.controller;

import com.sk.bilibili.dto.SlideCode;
import com.sk.bilibili.other.R;
import com.sk.bilibili.service.SlideCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @author 邵康
 * @date 2021/11/22 12:23
 */
@Api(tags = "滑动验证码相关")
@CrossOrigin
@RestController
@RequestMapping("/slideCode")
public class SlideCodeController {

    @Autowired
    private SlideCodeService slideCodeService;

    @ApiOperation("用于获取滑动验证码图片")
    @GetMapping("/generateSlideCode")
    public R<SlideCode> generateSlideCode(){
        return slideCodeService.generateSlideCode();
    }

    @ApiOperation("用于验证滑动验证码")
    @GetMapping("/checkSlideCode")
    public R<Void> checkSlideCode(Integer offset){
        return slideCodeService.checkSlideCode(offset);
    }

}
